import 'element-ui/lib/theme-chalk/index.css';

import Vue from 'vue'
import ElementUI from 'element-ui';
import App from './App.vue'
import VueRouter from 'vue-router'
import router from './router/index'
import axios from 'axios'

// axios的配置
axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded';
axios.defaults.withCredentials = true; // 允许跨域携带cookie
axios.defaults.baseURL = "http://localhost:2001/";
Vue.config.productionTip = false; // 禁用 vue 生产环境提示

// 引入插件
Vue.use(ElementUI)
Vue.use(VueRouter)

// 挂载axios到vue原型上 使所有组件都可以通过this.$http访问到axios
Vue.prototype.$http = axios;

new Vue({
    beforeCreate() {
        //安装全局事件总线
        Vue.prototype.$bus = this;
    },
    render: h => h(App),
    router: router
}).$mount('#app')
